package com.aldobucchi.core.comparison.ordered
{
	
	import com.aldobucchi.core.comparison.result.ComparisonResult;
	
	public class OrderedComparatorUtil
	{
		
		/**
		 * 
		 * Wraps the comparator in a function that you can use as value for mx.collections.Sort.compareFunction
		 * 
		 * @param comparator
		 * @return 
		 * 
		 */		
		public static function getSortCompareFunction( comparator:IOrderedComparator ):Function
		{
			return function( value1:*, value2:* ):ComparisonResult
					{
						return comparator.compare( value1, value2 );
					}
		}
		
	}
	
}